# -*- coding: UTF-8 -*-
# @Author ：
# @Date ：2023-11-22 11:49 

import time

from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.alert import Alert
from selenium.webdriver.common.by import By
from selenium.webdriver.support import wait, expected_conditions
from selenium.webdriver.support.color import Color
from selenium.webdriver.support.select import Select

driver = webdriver.Chrome()
prompt_url = 'http://sahitest.com/demo/mouseover.htm'
driver.get(prompt_url)

el = driver.find_element(By.CSS_SELECTOR, 'a>span')


print(el.size)

RED = Color.from_string('red')

bg_color = Color.from_string(el.value_of_css_property('background-color'))
color = Color.from_string(el.value_of_css_property('color'))
print(bg_color)
print(color)
# 验证背景颜色是否是红色
assert bg_color == RED


print(driver.find_element(By.NAME, 'b1').get_attribute('value'))
print(driver.find_element(By.NAME, 'b1').get_property('value'))